package com.xcc.observerpattern.demo2;

import lombok.Data;

import java.util.Observable;

/**
 * @Description WeatherData
 * @Author xiechuang
 * @Date 2022/7/21
 */
@Data
public class WeatherData extends Observable {

    private float temperature;

    private float humidity;

    private float pressure;

    public WeatherData() {
    }

    public void measurementsChanged() {
        setChanged();
        notifyObservers();
    }

    public void setMeasurements(float temperature, float humidity, float pressure) {
        this.temperature = temperature;
        this.humidity = humidity;
        this.pressure = pressure;
        measurementsChanged();
    }

}
